home *** CD-ROM | disk | FTP | other *** search
- '----------------------------------------------------------------
- '- more specialized little functions to make our lives easier.
- '- John Alspaugh 10OCT94
- '- Copyright 1993-1995 Virtus Corporation. All Rights Reserved.
- '-
- '- Note that this must be included after MSDETECT.INC and SETUPAPI.INC
- '-
- '----------------------------------------------------------------
- '-------------------------------------------------------------------
- '' VL_* functions are those with local variable references.
- '' V* functions can stand alone.
- '-------------------------------------------------------------------
-
- '' define one of these: PROGRAM or LIBRARY. It defines the dialog
- '' IDs and stuff.
- '$DEFINE PROGRAM
-
- '$ifdef PROGRAM
- '$DEFINE OPTION ''if OPTION, then give the user the choice of a custom install.
- ''''$DEFINE SERIAL ''no serial, no work.
- ''''$DEFINE CHATTER '' turns on the little blurby messages during the install
- '''$ELSE IF LIBRARY
- '$endif 'PROGRAM
-
- '*******************************************************************
- ' consts for dialogs
- CONST MODWININI_DLG = 7600
-
-
- '*******************************************************************
- ' declare all the functions up front.
- DECLARE SUB VL_Initialize
-
- DECLARE SUB VL_InitDiskCosts
- DECLARE SUB VL_RecalcOptFiles (ftype%)
- DECLARE FUNCTION VL_DoCheckItems(pItem$) AS INTEGER
- DECLARE FUNCTION VL_CalcDiskCost(pDrive$) AS LONG
- DECLARE SUB VL_SetupBillboards
-
- DECLARE SUB VL_InitDirNames
- DECLARE SUB VL_RecalcPath
- DECLARE SUB VL_AddOptFilesToCopyList (ftype%)
- DECLARE SUB VL_DoTheInstall
- DECLARE SUB VL_MakeTheAppIcons
- DECLARE SUB VL_ShowIconsOkay
- DECLARE FUNCTION VL_ShouldWeSerialize AS INTEGER
-
- DECLARE SUB VL_InitReadmeFileNames
- DECLARE SUB VL_MakeTheReadmeIcons
-
-
- '*******************************************************************
- ' these are the global variable things. They get used in lots of
- ' areas
- '' there should be one I* const for each checkbox in dialog #6200
- CONST IAPPFILES = 1
- CONST ILIBRARIES = 2
- CONST IMODELS = 3
- CONST N_CHECKBOXES = 3 '' you get this from counting the number of
- '' checkboxes in dialog #6200
-
- GLOBAL DESTDIRNAME$ '' the path of the destination directory
- GLOBAL PRODUCTNAME$ '' the real name of the product (like "Virtus VR")
- GLOBAL EXEFILENAME$ '' the name of the exe (like VIRTUSVR.EXE)
- GLOBAL PROGRAMGROUP$ '' name we want the group to have in the Program Manager
- GLOBAL DATAFILEEXT$ '' file extension for the models (VVR, WLK)
- GLOBAL INFFILENAME$ '' name of the INF file
- GLOBAL DEFDIRNAME$ '' default directory name
- GLOBAL THEINIFILE$ '' name of the ini file we associate our extension in
- GLOBAL BACKUPINIFILE$ '' name we back the ini file up to
-
- GLOBAL WINDRIVE$ '' windows drive (the windows dir is here)
- GLOBAL WINDIR$
- GLOBAL DIALOGDLL$ '' where the dialogs come from
-
- ''DECLARE SUB VL_Initialize
-
- '-------------------------------------------------------------------
- ' inits the variables specific to this installer.
- SUB VL_Initialize STATIC
-
- WINDIR$ = GetWindowsDir()
- WINDRIVE$ = ucase$(MID$(WINDIR$, 1, 1))
-
- '' REPLACE ME!
- PRODUCTNAME$ = "Design It! 3-D"
- EXEFILENAME$ = "DESIGNIT.EXE"
- PROGRAMGROUP$ = "Design It! 3-D"
- DATAFILEEXT$ = "VVR"
- INFFILENAME$ = "DESIGNIT.INF"
- DEFDIRNAME$ = "DESIGNIT"
- BACKUPINIFILE$ = "winini.dsn"
- '' REPLACE ME!
- DESTDIRNAME$ = WINDRIVE$ + ":\" + DEFDIRNAME$
- THEINIFILE$ = "win.ini"
- DIALOGDLL$ = "mscuistf.dll"
-
- END SUB
-
-
- '*******************************************************************
- ' Variable and functions for the disk cost stuff. There is one
- ' variable for each section in the dialog #6200. Also related are
- ' the I* constants in the previous section
- ''CustInst list symbol names
- GLOBAL APPNEEDS$ 'Application items need this much disk space
- GLOBAL LIBRARYNEEDS$ 'Gallery items need
- GLOBAL MODELNEEDS$ 'Scene items need this much disk space
- GLOBAL EXTRACOSTS$ 'List of extra costs to add per drive. This is how much we're short.
-
- ''DECLARE SUB VL_InitDiskCosts
- ''DECLARE SUB VL_RecalcOptFiles (ftype%)
- ''DECLARE FUNCTION VL_DoCheckItems(pItem$) AS INTEGER
- ''DECLARE FUNCTION VL_CalcDiskCost(pDrive$) AS LONG
-
- '-------------------------------------------------------------------
- ' inits the variables specific to calculating the disk costs
- SUB VL_InitDiskCosts STATIC
-
- ''Disk cost list symbols
- '' REPLACE ME!
- APPNEEDS$ = "AppNeeds"
- LIBRARYNEEDS$ = "LibraryNeeds"
- MODELNEEDS$ = "ModelNeeds"
- '' REPLACE ME!
-
- EXTRACOSTS$ = "ExtraCosts"
- FOR i% = 1 TO 26 STEP 1
- AddListItem APPNEEDS$, "0"
- AddListItem LIBRARYNEEDS$, "0"
- AddListItem MODELNEEDS$, "0"
-
- AddListItem EXTRACOSTS$, "0"
- NEXT i%
- END SUB
-
- '-------------------------------------------------------------------
- ' calculates disk cost
- SUB VL_RecalcOptFiles (ftype%) STATIC
- CursorSave% = ShowWaitCursor()
- ClearCopyList
- VL_AddOptFilesToCopyList ftype%
-
- fExtra% = 0
- ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
-
- IF ftype% = IAPPFILES THEN
- '$IFDEF PROGRAM
- IF GetListItem(CHECKSTATES$, IAPPFILES) = "ON" THEN
- ''Add extra cost to Windows drive for ini/progman, etc.
- ReplaceListItem EXTRACOSTS$, ndrive%, "10240"
- fExtra% = 1
- END IF
- '$ENDIF 'PROGRAM
- ListSym$ = APPNEEDS$
- ELSEIF ftype% = ILIBRARIES THEN
- ListSym$ = LIBRARYNEEDS$
- ELSEIF ftype% = IMODELS THEN
- ListSym$ = MODELNEEDS$
- ELSE
- ListSym$ = ""
- END IF
-
- StillNeed& = GetCopyListCost(EXTRACOSTS$, ListSym$, "")
-
- cost& = 0
- FOR i% = 1 TO 26 STEP 1
- cost& = cost& + VAL(GetListItem(ListSym$, i%))
- NEXT i%
- ReplaceListItem STATUSTEXT$, ftype%, STR$(cost& / 1024) + " K"
-
- IF fExtra% THEN
- ReplaceListItem EXTRACOSTS$, ndrive%, "0"
- END IF
- RestoreCursor CursorSave%
- ListSym$ = ""
- END SUB
-
-
-
- '-------------------------------------------------------------------
- ' handles the custom install (dialog #6200) checkboxes. Order is
- ' set in the dialog itself.
- FUNCTION VL_DoCheckItems(pItem$) STATIC AS INTEGER
- IF pItem$ = "CHK1" THEN
- VL_RecalcOptFiles IAPPFILES
- ok% = 1
- ELSEIF pItem$ = "CHK2" THEN
- VL_RecalcOptFiles ILIBRARIES
- ok% = 1
- ELSEIF pItem$ = "CHK3" THEN
- VL_RecalcOptFiles IMODELS
- ok% = 1
- ELSE
- ok% = 0
- END IF
-
- VL_DoCheckItems = ok%
-
- END FUNCTION
-
-
- '-------------------------------------------------------------------
- ' Calculates the cost of installing the items in the list by adding
- ' the cost associated with each of the items.
- FUNCTION VL_CalcDiskCost (pDrive$) STATIC AS LONG
- '$ifdef DEBUG
- if pDrive$ = "" then
- BadArgErr 1, "VL_CalcDiskCost", pDrive$
- end if
- '$endif ''DEBUG
- ndrive% = ASC(ucase$(pDrive$)) - ASC("A") + 1
-
- diskCost& = 0
-
- ''REPLACE ME BEGIN
- diskCost& = diskCost& + VAL(GetListItem(APPNEEDS$, ndrive%))
- diskCost& = diskCost& + VAL(GetListItem(LIBRARYNEEDS$, ndrive%))
- diskCost& = diskCost& + VAL(GetListItem(MODELNEEDS$, ndrive%))
- ''REPLACE ME END
-
- VL_CalcDiskCost = diskCost&
-
- END FUNCTION
-
-
-
- SUB VL_SetupBillboards STATIC
-
- ClearBillboardList
-
- AddToBillboardList DIALOGDLL$, 110, "FModelessDlgProc", 40
- AddToBillboardList DIALOGDLL$, 111, "FModelessDlgProc", 40
- AddToBillboardList DIALOGDLL$, 112, "FModelessDlgProc", 40
- AddToBillboardList DIALOGDLL$, 115, "FModelessDlgProc", 10
- AddToBillboardList DIALOGDLL$, 113, "FModelessDlgProc", 40
- AddToBillboardList DIALOGDLL$, 114, "FModelessDlgProc", 40
-
- END SUB
-
-
- '*******************************************************************
- ' Variable and functions to deal with the directory structure and to
- ' place items into the right directories
-
- ' these are the names of subdirectories
- GLOBAL GALLERY2DirName$ ' name of the 2dgallery
- GLOBAL GALLERY3DirName$ ' name of the 3dgallery
- GLOBAL MODELSDirName$ ' name of the Models dir
- GLOBAL SCENESDirName$ ' name of the scenes dir
-
-
- ' vars for the full paths
- GLOBAL GALLERY2Dest$ ' 2GALLERY
- GLOBAL GALLERY3Dest$ ' 3GALLERY
- GLOBAL MODELSDest$ ' MODELS
- GLOBAL SCENESDest$ ' SCENES
-
- ''DECLARE SUB VL_InitDirNames
- ''DECLARE SUB VL_RecalcPath
- ''DECLARE SUB VL_AddOptFilesToCopyList (ftype%)
- ''DECLARE SUB VL_DoTheInstall
- ''DECLARE SUB VL_MakeTheAppIcons
- ''DECLARE SUB VL_ShowIconsOkay
-
- '-------------------------------------------------------------------
- ' inits the variables for the directory management routines.
- SUB VL_InitDirNames STATIC
-
- ''LOCALIZE ME BEGIN
- GALLERY2DirName$ = "\2GALLERY"
- GALLERY3DirName$ = "\3GALLERY"
- MODELSDirName$ = "\MODELS"
- SCENESDirName$ = "\SCENES"
- ''LOCALIZE ME END
-
- END SUB
-
- '-------------------------------------------------------------------
- ' inits the variables specific to this installer.
- SUB VL_RecalcPath STATIC
-
- CursorSave% = ShowWaitCursor()
-
- GALLERY2Dest$ = DESTDIRNAME$ + GALLERY2DirName$
- GALLERY3Dest$ = DESTDIRNAME$ + GALLERY3DirName$
- MODELSDest$ = DESTDIRNAME$ + MODELSDirName$
- SCENESDest$ = DESTDIRNAME$ + SCENESDirName$
-
- VL_RecalcOptFiles IAPPFILES
- VL_RecalcOptFiles ILIBRARIES
- VL_RecalcOptFiles IMODELS
-
- RestoreCursor CursorSave%
- END SUB
-
-
- '-------------------------------------------------------------------
- ' inits the variables specific to this installer.
- SUB VL_AddOptFilesToCopyList (ftype%) STATIC
-
- IF GetListItem(CHECKSTATES$, ftype%) = "ON" THEN
- SrcDir$ = GetSymbolValue("STF_SRCDIR")
- IF ftype% = IAPPFILES THEN
- AddSectionFilesToCopyList "AppFiles", SrcDir$, DESTDIRNAME$
- AddSectionFilesToCopyList "AlwaysInstall", SrcDir$, DESTDIRNAME$
- ELSEIF ftype% = ILIBRARIES THEN
- AddSectionFilesToCopyList "2Gallery", SrcDir$, GALLERY2Dest$
- AddSectionFilesToCopyList "3Gallery", SrcDir$, GALLERY3Dest$
- ELSEIF ftype% = IMODELS THEN
- AddSectionFilesToCopyList "Models", SrcDir$, MODELSDest$
- AddSectionFilesToCopyList "Scenes", SrcDir$, SCENESDest$
- END IF
- SrcDir$ = ""
- END IF
- END SUB
-
-
- SUB VL_DoTheInstall STATIC
-
- CursorSave% = ShowWaitCursor()
-
- ClearCopyList
-
- IF (RADIOBUTTON$ <> "3") THEN '' CD_ROM install
-
- ''application
- IF GetListItem(CHECKSTATES$, IAPPFILES) = "ON" THEN
- CreateDir DESTDIRNAME$, cmoNone
- VL_AddOptFilesToCopyList IAPPFILES
-
- '' SetRestartDir WINDIR$ '' restart in
- END IF
-
- '' 2D & 3D galleries
- IF GetListItem(CHECKSTATES$, ILIBRARIES) = "ON" THEN
- CreateDir GALLERY2Dest$, cmoNone
- CreateDir GALLERY3Dest$, cmoNone
- VL_AddOptFilesToCopyList ILIBRARIES
- END IF
-
- '' VR scenes, models
- IF GetListItem(CHECKSTATES$, IMODELS) = "ON" THEN
- CreateDir MODELSDest$, cmoNone
- CreateDir SCENESDest$, cmoNone
- VL_AddOptFilesToCopyList IMODELS
- END IF
-
- ELSE
- SrcDir$ = GetSymbolValue("STF_SRCDIR")
- CreateDir DESTDIRNAME$, cmoNone
- AddSectionFilesToCopyList "AlwaysInstall", SrcDir$, DESTDIRNAME$
- ENDIF
-
- '$IFDEF CHATTER
- VL_SetupBillboards
- '$ENDIF '' CHATTER
-
- CopyFilesInCopyList
-
- RestoreCursor CursorSave%
-
- END SUB
-
-
- SUB VL_MakeTheAppIcons STATIC
-
-
- IF (GetListItem(CHECKSTATES$, IAPPFILES) = "ON") THEN
-
- '$IFDEF PROGRAM
- '' make backup for the win.ini file, tell user about it.
- winOld$ = VMakePath(GetWindowsDir(), BACKUPINIFILE$)
- sz$ = UIStartDlg("mscuistf.dll", MODWININI_DLG, "FInfo0DlgProc", 0, "")
- CopyFile VMakePath(GetWindowsDir(), THEINIFILE$), winOld$, cmoOverwrite, 0
-
- UIPop 1
-
- ''Create the WalkThrough group
- CreateProgmanGroup PROGRAMGROUP$, "", cmoNone
-
- IF GetListItem(CHECKSTATES$, IAPPFILES) = "ON" THEN
- ''Associate .WTP and files with the application. This is writing stuff to WIN.INI.
- CreateIniKeyValue THEINIFILE$,"Extensions",DATAFILEEXT$,VMakePath(DESTDIRNAME$, EXEFILENAME$)+" ^" + DATAFILEEXT$,cmoOverwrite
- CreateProgmanItem PROGRAMGROUP$, PRODUCTNAME$, VMakePath(DESTDIRNAME$, EXEFILENAME$), "", cmoOverwrite
- ENDIF
-
- '' if no WalkThrough, do the same with .wlk
- IF VFindExeFromRegistration ("WLK", lDest$) = 0 THEN
- CreateIniKeyValue THEINIFILE$,"Extensions","WLK",VMakePath(DESTDIRNAME$, EXEFILENAME$)+" ^" + "WLK",cmoNone
- ENDIF
-
-
- '$ENDIF '' PROGRAM
-
- '$IFDEF OPTION
- ELSEIF (RADIOBUTTON$ = "3") THEN '' CD_ROM install
-
- winOld$ = VMakePath(GetWindowsDir(), BACKUPINIFILE$)
- sz$ = UIStartDlg("mscuistf.dll", MODWININI_DLG, "FInfo0DlgProc", 0, "")
- CopyFile VMakePath(GetWindowsDir(), THEINIFILE$), winOld$, cmoOverwrite, 0
-
- UIPop 1
-
- ''Create the WalkThrough group
- CreateProgmanGroup PROGRAMGROUP$, "", cmoNone
-
- SrcDir$ = GetSymbolValue("STF_SRCDIR")
- '' strip off the directory we're in
- lDrive$ = SrcDir$
- StrLen% = LEN(lDrive$)
-
- '' Extract directory name (source)
- WHILE (MID$(lDrive$, StrLen%, 1) <> "\") AND (StrLen% > 1)
- StrLen% = StrLen% - 1
- WEND
- StrLen% = StrLen% - 1
- WHILE (MID$(lDrive$, StrLen%, 1) <> "\") AND (StrLen% > 1)
- StrLen% = StrLen% - 1
- WEND
- StrLen% = StrLen% - 1
-
- tempDir$ = MID$(lDrive$, 1, StrLen%)
- SrcDir$ = VMakePath(tempDir$, DEFDIRNAME$)
-
- otherOpt$ = VMakePath(SrcDir$, EXEFILENAME$)+","+"0"+","+"0,0,"+DESTDIRNAME$
-
- ''Associate .VVR and files with the application. This is writing stuff to WIN.INI.
- CreateIniKeyValue THEINIFILE$,"Extensions",DATAFILEEXT$,VMakePath(SrcDir$, EXEFILENAME$)+" ^" + DATAFILEEXT$,cmoOverwrite
- CreateProgmanItem PROGRAMGROUP$, PRODUCTNAME$, VMakePath(SrcDir$, EXEFILENAME$), otherOpt$, cmoOverwrite
-
- '' if no WalkThrough, do the same with .wlk
- IF VFindExeFromRegistration ("WLK", lDest$) = 0 THEN
- CreateIniKeyValue THEINIFILE$,"Extensions","WLK",VMakePath(SrcDir$, EXEFILENAME$)+" ^" + "WLK",cmoNone
- ENDIF
-
- '$ENDIF ''OPTION
-
- END IF
-
-
-
-
- END SUB
-
-
- SUB VL_ShowIconsOkay STATIC
- IF (GetListItem(CHECKSTATES$, IAPPFILES) = "ON") OR (RADIOBUTTON$ = "3") THEN
- ShowProgmanGroup PROGRAMGROUP$, 1, cmoNone
-
- '$IFDEF 0
- Restart% = RestartListEmpty()
- IF Restart% = 0 THEN
- Exe$ = WINDIR$ + "\_msrstrt.exe"
- Batch$ = WINDIR$ + "\_mssetup.bat"
- I% = ExitExecRestart ()
- RemoveFile Exe$, cmoForce
- RemoveFile Batch$, cmoForce
- END IF
- '$ENDIF '' 0
-
- END IF
- END SUB
-
-
-
-
- '-------------------------------------------------------------------
- ' do we want to call the serial number stuff?
- FUNCTION VL_ShouldWeSerialize STATIC AS INTEGER
- '$IFDEF SERIAL
- IF GetListItem(CHECKSTATES$, IAPPFILES) = "ON" THEN
- VL_ShouldWeSerialize = 1
- ELSE
- VL_ShouldWeSerialize = 0
- END IF
- '$ELSE
- VL_ShouldWeSerialize = 0
- '$ENDIF '' SERIAL
- END FUNCTION
-
- '*******************************************************************
- ' these are the global variable things. They get used in lots of
- ' areas
- GLOBAL MAINREADME_FILENAME$ 'name of the main readme file
- GLOBAL MAINREADME_ICONNAME$ 'name for the windows icon of the main readme file
- ''GLOBAL SCENEREADME_FILENAME$ 'name of the scenes readme file
- ''GLOBAL SCENEREADME_ICONNAME$ ' name for the icon for the scenes readme file
- GLOBAL EXTRAREADME_FILENAME$ 'name of the scenes readme file
- GLOBAL EXTRAREADME_ICONNAME$ ' name for the icon for the scenes readme file
- ''GLOBAL OTHERREADME_FILENAME$ 'name of the scenes readme file
- ''GLOBAL OTHERREADME_ICONNAME$ ' name for the icon for the scenes readme file
-
- ''DECLARE SUB VL_InitReadmeFileNames
- ''DECLARE SUB VL_MakeTheReadmeIcons
-
- '-------------------------------------------------------------------
- ' init the readme file names
- SUB VL_InitReadmeFileNames STATIC
-
- MAINREADME_FILENAME$ = "Readme.txt" '' name of main read me file
- MAINREADME_ICONNAME$ = "Read Me" '' icon title in windows
- '' EXTRAREADME_FILENAME$ = "PLAYREAD.WRI" '' name of extra read me file
- '' EXTRAREADME_ICONNAME$ = "Player Notes" '' icon title
-
- END SUB
-
- '-------------------------------------------------------------------
- ' make icons for the readme files
- SUB VL_MakeTheReadmeIcons STATIC
- ''Put icons for the sample scenes and the readmes into program manager. Check that one of the files exists)
- IF GetListItem(CHECKSTATES$, IAPPFILES) = "ON" THEN
- ''Create the readme
- CreateProgmanItem PROGRAMGROUP$, MAINREADME_ICONNAME$, VMakePath(DESTDIRNAME$, MAINREADME_FILENAME$), "", cmoOverwrite
- ELSEIF (RADIOBUTTON$ = "3") THEN '' CD_ROM install
- CreateProgmanItem PROGRAMGROUP$, MAINREADME_ICONNAME$, VMakePath(DESTDIRNAME$, MAINREADME_FILENAME$), "", cmoOverwrite
- END IF
-
- END SUB
-
-
-
-
-